<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title> <?php echo $list['list'][0] ? $list['list'][0]['name'] : '输错了吧 :)'?> - <?php echo $cats['parent']['name']?> - <?=SITE_NAME?> </title>
<meta content="text/html; charset=UTF-8" http-equiv="content-type" />
<meta name="Keywords" content="<?php echo $list['list'][0]['name']; if ($tags) foreach($tags as $tag) echo ','.$tag['name'];?>,LooPo,乐铺,创意礼品,创意礼物,创意生日礼物,创意杂货,创意家居,创意玩具,创意T恤" />
<meta name="Description" content="<?php echo $_desc = preg_replace('{&[a-z]+;|[\s\\r\\n]+}s', '', trim(strip_tags($list['list'][0]['desc'])))?>" />
<?php if($list['list'][0]['issale']<1)://不允许收录下架产品?><meta name="robots" content="noindex,noarchive" /><?php echo "\n";endif;?>
<?php include VIEWS.'header.html'?>

<?php
//TODO 重构
//SWFObject - Flash 处理
function _flash($desc) {
    static $_swfobject;
    $_swfobject++;

    if ($_swfobject==1) echo "\n<script type='text/javascript' src='/scripts/swfobject2.1/swfobject.js'></script>\n";
    echo "<script type='text/javascript'>swfobject.embedSWF( '{$desc[3]}', 'swf{$_swfobject}', '$desc[1]', '$desc[2]', '9.0.0', 'expressInstall.swf', false, {allowscriptaccess:\"no\",wmode:\"transparent\"});</script>\n";
    $str .= "<div id='swf{$_swfobject}' class='px12' style='width:{$desc[1]}px;height:{$desc[2]}px;'>影片链接：<a href='$desc[3]' target='_blank'>$desc[3]</a></div>";

    return $str;
}

$desc = preg_replace_callback('|<object.+width[=:][\s\'"]*(\d+).+height[:=][\s\'"]*(\d+).+value=[\'"]*(http[^\'"]+)[\'"]*.+</object>|is', '_flash', $list['list'][0]['desc']);
?>

<style type="text/css">
b.master {
    color: #FF6240;
    padding: 2px;
}

b.guest {
    color: #999;
    padding: 2px;
}

b.default {
    color: #FF6240;
    padding: 2px;
}
</style>

<script type="text/javascript">
<!--
function open_topic() {/*new Effect.ScrollTo('newcomment', {duration:2.0});*/$('c_text','newcomment').invoke('show');$('o_text').hide();window.setTimeout("$('body').focus();", 1000)}
function close_topic() {$('c_text','newcomment','updatemsg2').invoke('hide');$('o_text').show()}
<?php if($_GET['new']):?>window.onload=open_topic;<?php endif?>

var aa = ajaxStart();
var timer = null;

function addtoWishlist(remove) {
    try {
        if (remove)
            aa.call('/wishlist.php/add/<?php echo $list['list'][0]['id']?>', 'ajaxnewWishList', addtoWishlist_result, 'remove=1&iid=<?php echo $list['list'][0]['id']?>');
        else
            aa.call('/wishlist.php/add/<?php echo $list['list'][0]['id']?>', 'ajaxnewWishList', addtoWishlist_result, 'iid=<?php echo $list['list'][0]['id']?>');
        return false;
    } catch (e) {
        return true;;
    }
}

function addtoWishlist_result(result) {
    var i;
    var err = 0;
    var d = $('updatemsg');

    try {
        var stat = result.result[0].data;
        switch(stat) {
            case 1:
            case 4:
                i = '该物品已加入您的 Wishlist，您可以在我的乐铺中进行管理';
                $('addtowishlist').innerHTML = '<a style="font-weight:bold" onclick="javascript:return addtoWishlist(1);" href="/wishlist/add/<?php echo $v['id']?>?remove=1">从我的 Wishlist 中移除</a>';
                break;
            case 8:
                i = '该物品已从您的 Wishlist 中移除';
                $('addtowishlist').innerHTML = '<a onclick="javascript:return addtoWishlist();" href="/wishlist/add/<?php echo $v['id']?>">加入到我的 Wishlist</a>';
                break;
            default:
                err = 1;i = '未知错误('+stat+')，请稍候再试';
        }
    } catch(e) {
        i = '服务器错误，请稍候再试';
        err = 1;
    }

    if (i) {
        if (err==1) {
            d.style.backgroundColor= '#FF6600';
            d.style.color= '#FFF';
        } else {
            d.style.backgroundColor= '#DDF63E';
            d.style.color= '#000';
        }
        d.innerHTML = '&nbsp;&nbsp;&nbsp;乐铺提示：' + i + '……';
        $('tips').hide();
        $('updatemsg').show();
        new Effect.Round('div', 'updatemsg');
        if (timer) window.clearTimeout(timer);
        timer = setTimeout( "$('updatemsg').style.display='none';", 5000);
    }
}

function newComment() {
    var f = $('newcommentform');
    $('submit').disabled = true;

    try {
        aa.call('/comments.php/<?php echo $list['list'][0]['id']?>/new', 'ajaxNewComment', newComment_result, 'iid=<?php echo $list['list'][0]['id']?>&'+$('newcommentform').serialize());
        return false;
    } catch (e) {
        return true;
    }
}

function newComment_result(result) {
    var i;
    var err = 0;
    var ok = 0;
    var d = $('updatemsg2');

    try {
        var stat = result.result[0].data;
        switch(stat) {
            case 32: i = 'Email貌似不正确哦';err = 1;$('umail').focus();break;
            case 16: i = '姓名不能为空哟';err = 1;$('uname').focus();break;
            case 8: i = '你想说什么呀';err = 1;$('body').focus();break;
            case 128: i = '不要这么小气啊，再说点吧';err = 1;$('body').focus();break;
            case 4: i = '相同的话说一遍就行了喔';err = 1;$('body').focus();break;
            case 1:
                    var node = result.cdata[0];
                    var newhtml = '<div style="background-color:#F5F5F5;padding:4px;margin:6px;border:1px solid #EEEEEE"><b class="default">'+ node.uname[0].data +'<\/b>@'+ node.updated[0].data +'：<br />';
                    newhtml += '<blockquote style="margin:0.6em">' + node.body[0].data + '<\/blockquote><\/div>';
                    $('commentlist').innerHTML = newhtml + $('commentlist').innerHTML;
                    ok = 1;$('body').value = '';$('rand_code').value = ''; $('rand_code_img').src = '/rand_code.php?'+Date.parse(new Date());
                    close_topic();location.href='#tags';
                    break;
            case 256:  i = '您输入的验证数字不正确,或者您的留言中不包括中文，请检查';err = 1;$('rand_code').focus();break;
            default:
                       err = 1;i = '未知错误('+stat+')，请稍候再试';
        }
    } catch(e) {
        i = '服务器错误，请稍候再试';
        err = 1;
    }

    $('submit').disabled = false;
    if (i) {
        if (err==1) {
            d.style.backgroundColor= '#FF6600';
            d.style.color= '#FFF';
        } else {
            d.style.backgroundColor= '#DDF63E';
            d.style.color= '#000';
        }
        d.innerHTML = '&nbsp;&nbsp;&nbsp;' + i + '……';
        $('updatemsg2').show();
        new Effect.Round('div', 'updatemsg2');
        if (timer) window.clearTimeout(timer);
        timer = setTimeout( "$('updatemsg2').style.display='none';", 10000);
    }
    if (ok) $('updatemsg2').style.display='none';
}
//-->
</script>
</head>

<body>
<?php include VIEWS.'topbar.html'?>

    <div id="content">

        <?php include VIEWS.'leftnav.html'?>

        <div id="right">
                <?php if (count($list['list'])==0):?>
                <?php include VIEWS.'sidesearch.html'?><h1>是不是输入错了 :)</h1><div class="errbox roundNormal">&nbsp;&nbsp;&nbsp;没有找到您要查看的物品，为何不看看我们有哪些 <a href="/whatnew" class="white">新品上架</a>?</div>
                <?php else:
                    foreach ($list['list'] as $v):
                        //中图片不存在替换为小图片
                        if (!file_exists(ROOT.$v['pic']['m'])) $v['pic']['m'] = str_replace('.gif', '.jpg', $v['pic']['m']);
                        if (!file_exists(ROOT.$v['pic']['m'])) $v['pic']['m'] = $v['pic']['s'];
                        if (function_exists('getimagesize')) list(,,,$attr) = @getimagesize(ROOT.$v['pic']['m']);?>
                <div style="float:right;margin-right:10px;" class="px12"><a href="javascript:history.back()">&#8249; 后退</a> <br /> <br clear="all" /></div>
                <h1><?php echo $v['name']?><?php if($v['stocknum'] == 0):?> <span style='font-size:0.7em'>&bull;</span> <span style='font-size:16px'>缺货</span><?php endif?></h1>
                <?php $tips_drop_hide=true; include VIEWS.'shopcarinfo.html'?>

                <div id="itemdetail">
                    <table style="margin-left:20px">
                        <tr>
                            <td width="280" align="left"><div id="item<?php echo $v['id']?>" class="items"><a href="javascript:void(0)" class="nohv"><img<?php echo $attr ? " $attr" : ''?> hspace="20" src="<?php echo $v['pic']['m']?>" alt="<?php echo $v['name']?>" class="hand" /></a></div></td>
                            <td>
                                <font class="price">¥ <?php echo preg_replace('/^(\d+)\.(\d+)$/', '$1.<font size="-2">$2</font>', $v['price1'])?></font>
                                <?php if(intval($v['price2'])>intval($v['price1'])):?>&nbsp;&nbsp;<font class="price_small">特价</font><?php endif?>
                                <?php do_action('view_items_price_after', array('item'=>$v))?><?php if($v['postfee']>0):?><br /><b style="color:#DA1B3D">附加运费：</b><font class="price_small">&yen; <?php echo $v['postfee']?></font> &nbsp; <font class="px11">[<a title="为什么要多收我的运费？" href="/faq/35" target="_blank">?</a>]</font><?php endif;?><br /><br />
                                <?php if($v['issale']==0):?><b style="color:red">注：本商品已停止出售</b><br /><?php endif?>
                                <?php if($v['price2'] > intval($v['price1'])):?><b>原价：</b><?php echo $v['price2']?><br /><?php endif;?>
                                <?php if($session['admin'] & $v['stocknum'] > 0):?><b>库存：</b><?php echo $v['stocknum']?><br /><?php endif;?>
                                <!--<?php if($v['stuff']):?><b>型号：</b><?php echo $v['model']?><br /><?php endif;?>-->
                                <?php if($v['stuff']):?><b>材质：</b><?php echo $v['stuff']?><br /><?php endif;?>
                                <?php
                                //个性属性
                                if(is_array($v['cols'])) {
                                    for($i=1; $i<=5; $i++) {
                                        if ($v['cols']['key'.$i] && $v['cols']['val'.$i]) {
                                            if ($v['cols']['key'.$i] == '品牌') {
                                                $brand = $v['cols']['val'.$i];
                                                if (strtolower($v['cols']['val'.$i]) == 'loopo choice') $brand = 'LooPo';
                                                echo "<b>{$v['cols']['key'.$i]}：</b><a style='text-decoration:none' href='/brand/$brand'>{$v['cols']['val'.$i]}</a><br />";
                                            } else {
                                                echo "<b>{$v['cols']['key'.$i]}：</b>{$v['cols']['val'.$i]}<br />";
                                            }
                                        }
                                    }
                                }
                                ?>
                                <?php if($v['title']):?><b>说明：</b><?php echo $v['title']?><br /><?php endif;?>
                                <?php if($groups):?><b>款式：</b><select name="groups" class="px12" style="color:#666;width:130px;margin:0;padding:0" onchange="javascript:var jmpURL='/'+this.options[selectedIndex].value; if(jmpURL!='/' && jmpURL!='') {try{window.location.replace(jmpURL)}catch(e){location.href=jmpURL;}} else {this.selectedIndex=0;}"><option>请选择款式或颜色</option><?php foreach ($groups as $groups_v):?><option value="<?php echo $groups_v['id']?>"<?php if($groups_v['id']==$v['id']) echo ' selected="selected"'?>><?php echo $groups_v['groupvalue']?></option><?php endforeach;?></select><br /><?php endif?><br />
                                <?php if($v['stocknum'] > 0):?>
                                <a class="nohv" tabindex="2" onclick="javascript:addtocar(<?php echo $v['id']?>);return false;" href="/addtocar/<?php echo $v['id']?>"><img border="0" width="100" height="21" src="/images/addtocar.gif" alt="加入购物车" /></a>
                                <?php else:?>
                                <a tabindex="2" onclick="javascript:alertme(<?php echo $v['id']?>);return false" href="/alertme/<?php echo $v['id']?>/"><img border="0" src="/images/addtocar_alert.gif" alt="到货通知我" /></a>
                                <?php endif?>
                                <?php if($v['stocknum'] > 0):?><script type="text/javascript">new Draggable('item<?php echo $v['id']?>',{revert:true,onDrag:function(element){__dg(element)},onEnd:function(element){__de(element)}})</script><?php endif?>
                            </td>
                        </tr>
                    </table>
                </div>

                <div id="wishlist" class="px12" style="margin:10px;border-top:1px solid #CCCCCC;padding:10px;border-bottom:1px solid #CCCCCC">
                    &nbsp; &#8250; <a onclick="javascript:open_topic();return false" href="/comments/<?php echo $list['list'][0]['id']?>#new">说说我的看法</a>&nbsp;&nbsp;
                    <?php if($session['login']):?>&nbsp; &#8250; <span id="addtowishlist"><?php if($iswishlist):?><a style="font-weight:bold" onclick="javascript:return addtoWishlist(1);" href="/wishlist/add/<?php echo $v['id']?>?remove=1">从我的 Wishlist 中移除</a><?php else:?><a onclick="javascript:return addtoWishlist();" href="/wishlist/add/<?php echo $v['id']?>">加入我的 Wishlist</a><?php endif?></span>&nbsp;&nbsp;<?php endif?>
                    <?php if($v['price3']>0):?>&nbsp; &#8250; <a onclick="javascript:$('union_text').toggle();this.style.fontWeight=this.style.fontWeight=='bold' ? 'normal' : 'bold'" href="javascript:void(0)">放到我的博客中</a>&nbsp;&nbsp;<?php endif?>
                    &nbsp; &#8250; <script type="text/javascript">needHelp();</script><noscript><a href="<?php echo $_servername?>/forum/service/?from=item" target="_blank">需要帮助？</a></noscript>&nbsp;&nbsp;
                    <!--&nbsp; &#8250; <b>订购热线：</b><b style="color:#F60">400-6767-167</b> (免长途费)-->
                </div>

                <?php if($v['price1']>0):?>
                <div id="union_text" style="display:none;text-align:center;margin:1em">
                    <?php if($session['login']):?>
                    <p class="l16 px12">将下面的代码放入你的博客，有用户点击并购买本商品后，您可以获取 <b style="color:red"> 10%</b> 的销售提成！<a href="http://www.loopo.cn/blog/?p=56" target="_blank">了解详情</a></p>
                    <textarea readonly="1" rows="5" cols="80" class="px12" style="background:#EEE;border:1px solid #CCC;font-family:Courier New" onclick="this.select()">&lt;a href=&quot;<?php echo $_servername?>/<?php echo $v['id']?>?camefrom=<?php echo urlencode($session['username'])?>&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;<?php echo $_servername?><?php echo $v['pic']['m']?>&quot; /&gt;&lt;/a&gt;&lt;br clear=&quot;all&quot; /&gt;&lt;a href=&quot;<?php echo $_servername?>/<?php echo $v['id']?>?camefrom=<?php echo urlencode($session['username'])?>&quot;&gt;<?php echo $v['name']?>&lt;/a&gt;</textarea>
                    <?php else:?>
                    <p class="l16 px12">将一段代码放入你的博客或者网站上，有用户点击并购买后，您可以获取 <b style="color:red"> 10%</b> 的销售提成！<br />使用此功能您需要先 <a onclick="javascript:return login('_ll')" href="<?php echo $_servername?>/login?from=<?php echo $urlfrom?>">登录乐铺</a>！</p>
                    <?php endif?>

                    <hr size="1" />

                </div>
                <?php endif?>

                <div id="itemdesc">
                <?php
                //产品介绍
                echo $desc;
                ?>
                </div>

                <?php if($tags):?>
                <a name="tags"></a>
                <div id="itemtags" class="px12" style="margin:10px;border-top:1px solid #CCCCCC;padding:10px;border-bottom:1px solid #CCCCCC;margin-bottom:0;">
                    &nbsp; &#8250; &nbsp;<b><a href="/tags/" title="查看更多标签">乐铺标签</a></b>：&nbsp;
                    <?php foreach($tags as $tag): if(strpos($tag['name'],':')) continue?><a tabindex="3" href="/tag/<?php echo urlencode($tag['name'])?>"><?php echo $tag['name']?></a> <?php echo "({$tag['ct']})"?>&nbsp; &nbsp; <?php $tagname[]=$tag['name']; endforeach?>
                </div>
                <?php endif?>


                <?php if($related):?>
                <div id="related" class="px12" style="margin:10px;border-top:0px solid #CCCCCC;padding:10px;border-bottom:1px solid #CCCCCC">
                    &nbsp; &#8250; &nbsp;<b>您或者同样会喜欢以下物品</b>：<?php if(count($tagname)>3):?>(<a class="px10" href="/tag/<?php echo urlencode(join(',',$tagname))?>/2/?o=3&amp;title=乐铺猜您会喜欢">more...</a>)<?php endif?>
                    <div align="center" style="text-align:center;margin-top:6px"><?php foreach($related as $r_v):?><a class="nohv" title="<?php echo $r_v['name']?>" href="/<?php echo $r_v['id'].'/'.$pid?>" onmousedown="return cl(this,'<?php echo $v['id']?>','items:click','<?php echo $v['sig_click']?>')"><img style="cursor:pointer" class="hand" border="0" alt="<?php echo $r_v['name']?>" src="/images/items/s/<?php echo $r_v['model']?>.gif" width="150" height="150" hspace="15" /></a><?php endforeach?></div>
                </div>
                <?php endif?>

                <div id="favbtn_div">
                    <ul id="favbtn">
                        <li class="px12">&nbsp; &#8250; &nbsp;<b>喜欢就帮忙推荐一下吧</b>： &nbsp; </li>
                        <li><script type="text/javascript">addthis_pub  = 'aficbl';</script><a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"><img src="http://s7.addthis.com/button1-bm.gif" width="125" height="16" border="0" alt="" /></a><script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"></script></li>
                    </ul>
                </div>

                <a name="comments"></a><br />
                <p class="px12"><b>引用后通告地址 (TrackBack URL) [<a href="/faq/38" target="_blank" title="TrackBack 是什么东西">?</a>]:</b> &nbsp; <?php echo str_replace('www.','',$_servername)?>/trackback.php/<?php echo urlencode(base64_encode($v['id']))?>/</p>

                <div id="commentlist" style="margin:10px" class="px12">
                    <?php if(count($comments['list'])>0) foreach($comments['list'] as $c):$c_i++;?>
                    <div style="background-color:#<?php echo $c_i%2==0 ? 'EEEEEE' : 'F5F5F5'?>;padding:4px;margin:8px;border:1px solid #EEEEEE">
                        <img alt="" width="32" height="32" src="http://www.gravatar.com/avatar.php?gravatar_id=<?php echo md5($c['umail'])?>&amp;size=32&amp;default=<?php echo $_servername?>/images/icon/no-gravatar.gif" align="left" hspace="5" />
                        <?php echo ($c['istb'] ? '<b class="default">TrackBack:</b>' : '') . ($c['url'] ? "<a href='{$c['url']}' target='_blank'>" : '') . '<b class="'. ($c['isadmin'] ? 'master' : ($c['uid'] ? 'default' : 'guest')) .'">' . ($c['uname'] ? $c['uname'] : 'guest').'</b>' . ($c['url'] ? "</a>" : '') . '@'.date('y/m/d H:i', $c['updated'])?> (<a href="/comments/<?php echo $v['id'].'#c'.$c['id']?>" class="px12">永久链接</a>)<br /><blockquote style="margin:0.6em"><?php echo nl2br($c['body'])?></blockquote></div>
                <?php endforeach?>
            </div>

            <br />

            <div style="float:right;margin-right:1em" class="px12"><br />&#8250;&nbsp;<a href="#top" onclick="new Effect.ScrollTo('top'); return false;">返回页首</a></div>
            <?php if($comments['page']['total']>5):?><div style="margin:10px" class="px12"><img alt="arrow right" src="/images/icon_arrow_red_right.gif" /><a href="/comments/<?php echo $comments['item']['id']?>">查看所有的<?php echo $comments['page']['total']?>条评论</a></div><?php endif?>
            <div id="o_text" style="margin:10px" class="px12"><img alt="" src="/images/icon_arrow_right.gif" /><a onclick="javascript:open_topic();return false" href="/comments/<?php echo $list['list'][0]['id']?>#new"><?php echo $comments['page']['total'] ? '说说我的看法' : '别潜水了，点击这里坐沙发'?></a></div>
            <div id="c_text" style="margin:10px;display:none" class="px12"><img src="/images/icon_arrow_down.gif" alt="arrow down" /><a onclick="javascript:close_topic();return false" href="/<?php echo $list['list'][0]['id']?>">取消发表</a></div>
            <div id="newcomment" style="margin-left:20px;font-size:12px;padding-top:10px;margin-top:10px;display:none">
                <div class="updatemsg2" id="updatemsg2" style="font-weight:bold;background-color:#DDF63E;font-size:12px;width:80%;display:none;">&nbsp;</div><br clear="all" />
                <form action="/comments.php/<?php echo $comments['item']['id']?>/new" method="post" id="newcommentform" onsubmit="javascript:return newComment();">
                    <textarea class="px12" id="body" name="body" rows="10" cols="70" style="width:520px"><?php echo $comments['data']['body']?></textarea><br />
                    <?php if(!$session['login']):?>
                    姓名：<input class="px12" value="<?php echo $comments['data']['uname']?>" id="uname" size="10" maxlength="20" type="text" name="uname" /> &nbsp;
                    Email：<input class="px12" value="<?php echo $comments['data']['umail']?>" id="umail" size="10" maxlength="60" type="text" name="umail" /> &nbsp;
                    请输入右边的数字：<input id="rand_code" class="px12" type="text" name="rand_code" value="" size="8" maxlength="4" /> &nbsp; <img alt="" id="rand_code_img" src="/rand_code.php" style="vertical-align:absmiddle;" /> <br />
                    <?php endif?>
                    <br /><br />
                    <input tabindex="3" id="submit" type="submit" value="好了，就这样" class="bluebtn" /> &nbsp; <input tabindex="3" type="reset" onclick="javascript:close_topic()" value="取消" class="darkbtn" />
                    <?php if(!$session['login']):?> &nbsp; <a class="px12" href="/login?from=<?php echo urlencode($_SERVER['REQUEST_URI'].'#comments')?>" onclick="javascript:return login('_ll')">会员请登录</a><br /><?php endif?>
                </form>
            </div>
            <div style="margin:10px" class="px12"><img alt="" src="/images/icon_arrow_right.gif" /><a href="/photo" target="_blank">提交照片，赢100元购物券</a></div>

            <?php endforeach?>

            <?php endif;?>

        </div>
    </div>

    <?php if ($wish):?>
    <script type="text/javascript">
        $('tips').innerHTML = '&nbsp;&nbsp;&nbsp;想要给<?php echo $wish['username'] ? ' <span style="color:#FF6600">'.$wish['username'].'</span> ' : '朋友'?>一个 Surprise 吗？送给他最喜欢的礼物吧！';
        $('tips').show();
        new Effect.Round('div', 'tips');
    </script>
    <?php endif?>

    <?php include VIEWS.'copyright.html'?>

</body>
</html>
